#include <QBoxLayout>

#include "settingsdialog.h"

SettingsDialog::SettingsDialog(QWidget * parent)
    : QDialog(parent)
{
    QVBoxLayout * mainLayout = new QVBoxLayout(this);
    m_tabWidget = new QTabWidget(this);
    mainLayout->addWidget(m_tabWidget, 1);

    QHBoxLayout * buttonsLayout = new QHBoxLayout(this);
    buttonsLayout->addStretch(1);
    m_okButton = new QPushButton(tr("OK"), this);
    buttonsLayout->addWidget(m_okButton);
    connect(m_okButton, SIGNAL(clicked()), this, SLOT(okClicked()));
    m_cancelButton = new QPushButton(tr("Cancel"), this);
    buttonsLayout->addWidget(m_cancelButton);
    connect(m_okButton, SIGNAL(clicked()), this, SLOT(cancelClicked()));
    mainLayout->addLayout(buttonsLayout);

    setLayout(mainLayout);
}

void SettingsDialog::addSettingsWidget(SettingsWidget * widget)
{
    m_tabWidget->addTab(widget, widget->title());
}

void SettingsDialog::okClicked()
{
    hide();
}

void SettingsDialog::cancelClicked()
{
    hide();
}

